package com.huali.dao;

import com.huali.entity.User;

import java.util.List;
import java.util.Map;

public class TestDao {

    /**
     * 查询 user表所有数据
     *
     * @return list
     */
    public List<Map<String, Object>> getAll() {
        // SQL语句
        String sql = "select * from user";
        //执行SQL
        List<Map<String, Object>> list = BaseDao.executeQuery(sql);
        return list;
    }

    /**
     * 根据id修改用户
     *
     * @return int
     */
    public int updateById(User user) {
        String sql = "update user set name=? ,age = ?, sex = ?,password = ? where id =?";
        int i = BaseDao.executeUpdate(sql, user.getName(), user.getAge(), user.getSex(), user.getPassword(), user.getId());
        return i;
    }
//页面
//servlet 控制层
//service 业务逻辑层
//dao 数据访问层
}
